package com.hmdp.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfiguration {
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redissonClient() {
        Config config = new Config();
        config.useSingleServer()
                .setAddress("redis://192.168.220.128:6379")
                .setPassword("159753852")
                .setTimeout(3000) // 设置超时时间
                .setRetryInterval(1500); // 设置重试间隔
        return Redisson.create(config);
    }
}
